/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vek.Objects;

import java.util.ArrayList;
import vek.XML.parsedObjects.ParsedMuseum;

/**
 * a Museum POI.
 * This class has all the functionality of the POINonComercial class, but also has exhibitions
 * @author Christian, Michal og Jakob (Hold1, gruppe 2)
 */
public class Museum extends POINonComercial{
    
    protected ArrayList<String> typesOfExhibition;
    
    /**
     * Creates an Museum object and assigns its varaibles using data from the a ParsedObject.
     * @param pm the ParsedMuseum which is based on XML which has the data which this ojbect is to contain.
     */
    
    public Museum(ParsedMuseum pm)
    {
        super(pm.parsedNonComercial);
        typesOfExhibition = pm.typesOfExhibition;
    }
    
    /**
     * Gets this POI as a string, overrides the toString method in POINonComercial, but also calls that mehod.
     * First it calls the super method, then it appends the exhibition information at the end of the string
     * @return the string containing the value of the variables of this object
     */
    
    @Override
    public String toString()
    {
        String s = super.toString();
        s += " Exhibitions: ";
        for(int i = 0; i < typesOfExhibition.size(); i++)
        {
            s += typesOfExhibition.get(i); 
        }
        return s;
    }
    
    /**
     * Gets the types of exhibitions this Museum has
     * @return the types of exhibitions this object has
     */
    
    public ArrayList<String> getTypesOfExhibitions()
    {
        return typesOfExhibition;
    }
    
    /**
     * Checks if this object has exhibitions which start with the specified string
     * @param s the string which at least one of this museum's exhibitions should start to return true 
     * @return true if at least one exhibition starts with the speciefied string
     */
    
    public boolean hasTypesOfExhibitionsStartsWith(String s)
    {
        for(int i = 0; i < typesOfExhibition.size(); i++)
        {
            if(typesOfExhibition.get(i).startsWith(s))
            {
                return true;
            }
        }
        return false;
        
    }

}
